import request from '/@/utils/request';

/**
 * （不建议写成 request.post(xxx)，因为这样 post 时，无法 params 与 data 同时传参）
 *
 * 用户api接口集合
 */
export function userApi() {
	return {
		getUserInfo: (data: object) => {
			return request({
				url: '/user/getUserInfo',
				method: 'get',
				data,
			});
		},
		getUserRoleIds: (params: object) => {
			return request({
				url: '/user/roleIds',
				method: 'get',
				params,
			});
		},
		getUserOptions: () => {
			return request({
				url: '/user/options',
				method: 'get',
			});
		},
		addUser: (data: object) => {
			return request({
				url: '/user/add',
				method: 'post',
				data,
			});
		},
		deleteUser: (params: object) => {
			return request({
				url: '/user/delete',
				method: 'delete',
				params,
			});
		},
		pageUser: (data: object) => {
			return request({
				url: '/user/page',
				method: 'post',
				data,
			});
		},
	};
}
